formatting changes and remove unused variables
put back clearWorkbenchState Fixes #3955