starting subtract method and create sort function