1. first update, not tested. This was a part of my game project. Now I
divide it from project and hope someone will need it.