[3.0] pan-gesture code refactor and environment variables