refactor with delayed loading