update test, improve code