Made code structure more consistent.