renamed variable 'tres' (which should have meant 'temporary result') to 's' for 'status' in the hope that this is a better name for it