Trying to make new algorithm