finale version that needs unittest and more testing