Refine tests

Refining the way the code is tested. Mainly becausethe way that a random string was tested before wasn't actually testing whether or not it was random. Swapped around a few parts of the rest of the code as well to make it more dry.