Refactor, add client side stuff