added persist functionality