added custom config support
begin some cleanup
throw more meaningful exceptions
more cleanup
code cleanup