merged with jaimes code