updated API and added a simple test