Add comments and implement command line interface.