Edited javascript closures