Added challenge requirements
Added more defensive coding