Adding store and fixing javascript error