Removing duplicate code
A fix for the unit test