Added forKeys method, more tests and work at fixing some bugs