Added client and fixed a few bugs