Moved object tracking into an object and implemented x/y and direction calculations.