added algorithm to comments