add rotate alogrithm