Refactors Main.hs a bit