added pause function, improved formatting