Moved $http calls into a service which can cache the result locally.
Improved size calculations for images