refactor to blocks