Bugfixing

Error reporting and fixing mostly.
Need to work on CLI and do some serious optimizing