Refactor the code, now is more readable