Update UI, factoring and add test