Cleaned up client side code