added some alert() code for debugging