updated for rcarmo's branch