refactor and export api

options argument added to all functions.
db path is put inside options argument.