code duplication. It;s better to move it out in separate static library, fot example 'utils'