Improvements and fixes by dusank - Part 2