use flycheck provided functions
Merge pull request #4 from danielwuz/minor-refactoring

use flycheck provided functions