introduced json based config
improved error code handling
Merge pull request #9 from 0x7f/master

config & error handling