Added default return values, other misc fixes.