Implemented persistent option, fixed file naming bugs