Added new tests. Made all test passed. Done refactoring.