added more tests
refactored and organised code