Multiple changes

Saving new data from controller
Functions to calculate distance on Y, X axis