Implemented the task No.7. VERY DIRTY CODE!!