move js to separate file, add undo functionality