begin to implement sorting