finished implementation of IN & OUT