update code to more consitent