Wait for DOMContentLoaded instead of just delaying 2s, as suggested by original author:brian-c