moved global variables to main.c

@Fabian: hope this is fine?