sync functionality and cleanup