Minor bug fixes, removal of cruft