refined and tested