Fixes based on frankban's review.