Updated and integrated code