Refactor to use parser