Lazy loading

Implement lazy loading.

Please review each commit individually.