added sorting methods

the improved one doesnt work