Tidying up and removing some warnings