Added storing changes and applying them all at once
Refctored applying changes