more error checking, restructured config