main() now blocks until a signal is received instead of looping infinitely and hogging the cpu