Still in work - have to optimze it and to make it as a new function