changed API to make it easy to add new functions