refactor one liner code