Code organizing, minor bug fix, and localStorage support

Bug was more of an annoyance than anything.