Partial refatoring and reorganization of code