pre-merge commit. Fixed some things and cleaned up a bit.