refact and introduce some utils