use better rust syntax and core functions