A method for sticking to habits