Added reading from stdin and some basic signal handling