first attempt at flipping the ends