Made fixes to building and reordered some tasks