restructure casting