Working up the client code

Also adds some fluff, comments and overall tweaks and tune-ups