Implemented flag printing

resolved small bug in flagging code - error messages sometimes have
leading space.