tidying and fixing warnings