manually added Natalia's changes from UConn MAGIC