written reshape functions.