Mostly code cleanup