[WIP] Massive refactor