globals look OK now, params too, but use statements are in the wrong place...