Moved everything around to seperate client side from server side code