Changed random key algorith to avoid issues with quotes