Refactor client_side.js