Few global variables declared, fiddled with code but don't know what I'm doing.