Added smartShape helper function.