added rotate and flip functionality