Refactor to group inputs into hashmaps.