improved js interface for contract calling