Первая часть: http://gi.reactor.cc/post/5094149
Вторая часть: http://gi.reactor.cc/post/5095286