Better code style in some routines