Window size is read from an environment variable. Also, refactored.