Add atomic actions and refactor the code in order to use this new feature