refactor (prepare for different input type)