Improved api and added more features

Todo: provide more details into exceptions thrown