Huge refactor. Using PHPStorm from now.