corrected code wrt some PMD inspections