seperated user logic from view