Fixed some things, should be a bit more resource friendly now