clean up and use env-hook for configuration