refactor structure for reuse