total rework of code