merged changes from codility
removed uslesss unite function