Major code overhaul, first working build