move utiliti functions into separate module