merged and tidied