Upgraded to work with latest libraries