first implementation of Randy's design