Ported most of the previous progress