Added missing return statements.
Changed variable declarations.