Some fixes and error handling
As exe
major cleanup