Refactorized, structure makes a lot more sense now