Got rid of globals