wrapper to read input and generate output