nearly completed basic test suite and fixed type check