refactoring by hlint and -Wall and correct (exit)