update: add exception handling etc.