cleanup main class and make failure_limit configurable