Refactoring to make code a little more clear.