clarified init steps by using read/prepare/build phases, added resource md sorting