working version supplied by fikretulug
fixup classes