Refactor to include assertions