Removed some code, reworked into a module