tidy and warnings fixed