Cleaned up the store() code and added busy wait.