refactoring the apios