Define init function. Make variables actually global