Updated to work with updated python API