Changed compilation order so that reimaging comes first