Cleanup

Fixed an error for saving databases, added comments, made the length of the generated text variable.