I have been messing with this all day and just can not seem to get it

The code that controls what I'm trying to do is this:
PHP Code:
if ($flag_show_product_info_reviews == 1) {
    // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
    if ($reviews->fields['count'] > 0 ) { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' zen_href_link(FILENAME_PRODUCT_REVIEWSzen_get_all_get_params()) . '">' Read_all_reviews '</a>'?></div><!--. zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) .-->
<!--<br class="clearBoth" />-->

<?php //bof added code per Average Product Rating
         
echo '<p class="reviewCount">';
         if (
$flag_show_product_info_reviews_count == 1) {
           
//echo TEXT_CURRENT_REVIEWS . ' <strong>' . $reviews->fields['count'] . '</strong><br />';
           
$stars_image_suffix str_replace('.''_'zen_round($reviews_average_rating->fields['average_rating'] * 20) / 2); // for stars_0_5.gif, stars_1.gif, stars_1_5.gif etc.
           
$average_rating zen_round($reviews_average_rating->fields['average_rating'], 2);
           echo 
TEXT_CURRENT_REVIEWS_RATING ' <strong>' $average_rating '</strong> ' zen_image(DIR_WS_TEMPLATE_IMAGES 'stars_' $stars_image_suffix '.gif'sprintf(BOX_REVIEWS_TEXT_OF_5_STARS$average_rating));
         } else {
           echo 
'';
         }
         echo 
'</p>';
       
?><!--eof added code per Average Product Rating-->
<?php } else { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITEzen_get_all_get_params(array())) . '">' Write_a_review '</a>'?></div><!--zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT)-->
I am trying to move the 'Customer review' above the 'Read all reviews' link and then add a 'Write a Reviews' link next to 'Read all reviews'.

It would be great if a fresh pair of eyes can look at it for me and show me what I've been doing wrong.