added math functions for distance calc, bunch of front-end changes on login etc