Added closure to bootstrapping in order to detect various environments in which the code will operate.