Some Improvements

* some fixes and code improvements according to the comments by aurimasv and adam3smith