Latest changes, bug fixes and tidying stuff up