refactors couple of lines