Additional tests & refactoring

Added new test cases and performed minor refactoring.