refactor some code :D