code tidy up  after static analysis