some code rework