simple code restructuring