Ok, I've implemented some solution to this problem.