Reduces redundancy in the lazyload code

This replaces Pull Request #6