cleaning up calling interface and encapsulated the function calling
adding release calls