Smarter preloader

Fixes #2