handleIn and handleOut