Replace if with when.
Make eta reduction.
Do little refactoring.
Remove redundant map.