Starting to refactor the code to make it a bit cleaner and more idiomatic.