It works but already smells horrible. Refactoring.