cleanup whitespace
rearrange stages dictionary