Using animate duration trick
Shortened code by changing positioning functions (x and y) to use a duration of 0 instead of a boolean check
Minor slip - replaced 0 with duration