added sorting methods, make lib require compatible