Fixed warnings/potential bugs. Functions that should return values now do.