implement shutdown
add -E
some cleanup