better ruby style on some changes