Fixed some bugs, added a config file