Adding script itself after some cleaning&improvements.