Refactor according to HLint suggestions