removed usage of globals