* refactor in functional way