Made some performance improvements and fixed an issue with time limit
option in the config file