Improved handling of terminal output

* Improved handling of terminal output
* Added general settings tab in preferences window
* Cleanup old hist file