pan-gesture code refactor and environment variables