finalising all functionality up to the user login stuff