Clean up code a bit, make it possible to disable reloading.