cleaning up some of the wheres
adding basic tests, updated docco