updated with later code