Add input offset and output writing