Adpated to new API