refactored to in/do/out