Refactored and added new features
Test