finished sorting
added some documentation