Client changes

1) Some comments added
2) General fixes and optimization