minimal working code needs improvement