removes extra sorting, fixes #112, moves sorting to image model