started algorithm stuff