added is_valid(); added more checking to address