getting rid of dx/dy cycles