minor refactor and remove checkstyle warnings