a little cleanup and restructuring