Eliminated globals, fixed style/lint.