started reorganization of code