refactor code for making icons