Code and interface cleanup

Added comments, removed some unused code, injected some sanity into the
rest.