Added some exception handling and generic constructors to look for de
buggs.