Some code cleanup