Bunch of improvements and fixes

Hi Egor, your tool was very useful for me and i have implemented several fixes and improvements to make it even better.