Some code restructuring.