New stuff

Added line count to the main write loop