minor code overhaul