Getting rid of globals