Add localstorage support to save results. +Some bug fixes