Added proper code for new maintenance mode feature.
Tweak maintenace mode handler.
Added clear compile pre update script.