Implement Javascript module pattern