finished, need to check sorts and refactor