made code part runnnable
prettified output
part 8 write finished