working version
flags completed