Corrected code (return values, style...)