added block retrieve code