added some validation; still more needed