[Updated] Massive refactor