Huge code overhaul, getting stuck somewhere