added some docu and exception handlling