simpdanny version before integrated

should be combined with Peter's