Cleaner implementation for out and in.