Added in a config file and fine control through it.
Fixed some bugs.