Updated API logic.