Wrapped JS code in closures for best practice