More changes

Fixed the main issue, and made a few other changes like improvements to the random number generation and removing the '.json' from the keys.