Big refactor (don't sync if you want to use editor)