Some general code cleanup