refactored in order to maximize using of sparse api