updated to do the inverse