Attempt at clean code