almost there. added some tests
complete tests and cleanup