add top_test export
tidy code and remove trailing spaces