Rough version.  Heavy modification