Changed multiple print calls to one stdout.write, changed var names