First commit of most code with some recent bug fixes and changes.