single quotes, removed global vars, cleanup