refactoring based on find bugs issues