Restructuring.

More object-oriented, considering modals. (Stole code from work stuff
nobody wants to use.)