Cleaned up window & location code in scripts cont.