Fixed some compiler warnings and followed hlint suggestions