restructured code. Now with twice the pretty.