merged with Peter & Zygintas' work