complete start of re-implementation