Refactor atomic add and sub