Updating: reorganizing some code