updated the API with backward compatibility
changed input of functions to new fromat