Changes to client and permission services, and dao's. As well as general code clean up.