Update bug fixes and cleanup

Formatting and code cleaned.  Bug fixes regarding mTools mostly fixed