refactored to reduce tst exec time