Rearranged startup routine