Refactor to a simpler structure