Refactor code to be lighter