Mostly some code cleanup