refactored all sortsa stuff