Added recursion and rotation.