Refactor code a bit to make it more readable.