proper sorting closes #4