Ported to the new delayed loading API

* Now supports the delayed loading API
* Simplified the code