commented working code