refactor inputs/outputs