Made some changes to comply with PEP8, standardised naming and added a random string generator to create a filename if one isn't supplied.