Remove slide nesting, tidy up code