Fixed error handling and added rotation

And I changed argument names into the general thing.