by slashrsm: Fixes as per code review.