added localStorage support, moved generic functions to base model