re-factored carousel

• placed the code into a shared object instead of having it repeated wherever it was used