Added missing @throws and @return + code fixes.