corrected code according to phase 1 inspection