refactor config remove conditions and trylock and other code review fixes