Restructure classes, less global variables