shorten cwd code
sort some variables