Fied code; Added more tests