fix reference
simplify reference
improve tests