Refactoring & Adding more Tests