Huge engine rewrite