-Massive code refactor