Fixing errors and warnings