almost finished version.