warnnings corrected and code formated