implemented localStorage functionality