restructuring and removing old code