Refactoring in Board. Added undo function.