Moved out var definitions, functions