added more functionality to closure, without altering original JS