implemented flag implications, fixed #14, #37, #42