refactor if rivets adapter and comments