Used env vars for configuration. Made the opening more reliable