added pickup auto-kill and tweaked variable scope