Refactor. Simplify the code.