Refactor and add xml for statements