More refactoring and added second test