Updated to use REST API (work in progress)