started reversing the function