Refactoring the normilize method