Huge refactior