Minor Changes

Made global variable static, got rid of a couple temp variables