Minor fixes and restructuring.