Wrap Javascript declarations inside an anonymous function