Changes suggested by Roman to get code working.