Improved global statements in functions