Adding compare and swap program + minor fixes