cleaning up registry code