Fixed the input and output arcs

Only thing remaining is the query which should be better :)