Major Code Refactor

Moved the history functions into their own file and dynamically
allocated cmd 2D array
Just small stuff
Rolling back!