Add unit test, removed unnecessary method
Minor code refactoring, renaming of variables