useless code cleanup
add autochdir setting
code format