Code cleanup, removing local variables where globals make sense
Code cleanup