refactored
added in hai's tests
added hai's tests