adding in REST API logic