(cleanup) Clean-up client-side code. Add comments.

@blankmaker