a nice utility funtion