more code overhaul