ME: refactored clone api endpoint and added a test for it