working version with localStroage