This should look a lot cleaner

Better Exception-handling, merge things, clean-ups, fixes, shorter names
..