made program prettier in the serial output and fixed a timing issue