Adapt and improve nightlycompile script