Refactor client-side
Add documentation