semi working code