adding localStorage support, polished some stuff.