moved some utils func