added sorting to system