refactoring for newkoding