#3 #16 Refactor code