kaloyan's code implemented into the solution, tnx Kala :)