Pull distance calculation out of controller and fix style bug on calendar