Customized theme not working How do I display a form followed by a table in a module??

I have this:

function main_function(){
  $form = drupal_get_form("report_details_form");
  $tabb = array(
    'header' =&gt; $header,
    'rows' =&gt; $rows,
    'caption' =&gt; $caption,);
  $output = theme("table", $tabb)
  $final_output = theme("report_page", $form, $output);
  return $final_output; 
}

function theme_report_page($form, $result = array()) {
  $output = '
    &lt;div id="report_form"&gt;
    '. $form .'
    &lt;/div&gt;
    &lt;div id="report_result"&gt;
    '. $result .'
    &lt;/div&gt;';
  return $output;
}


What am I doing wrong? I am using Drupal 7. I need to display the form and under it the table. There is nothing wrong with $form or $output. If I return them in the main_function they will display correctly.

I don't NEED a theme, I just need to display a form and table on the same page. So if it is to demanding I can skip it, and just have the form and table displayed.

I changed the main_function a bit to this:

function main_function(){
 $form = drupal_get_form("report_details_form");
 $tabb = array(
  'header' =&gt; $header,
  'rows' =&gt; $rows,
  'caption' =&gt; $caption,);
 $output = theme("table", $tabb)

$build['content'] = array(
  'this_does_not_matter_too_much2' =&gt; drupal_get_form("report_details_form"),       
  'this_does_not_matter_too_much1' =&gt; array('#markup' =&gt; $output,),);

$build['pager'] = array(
    '#theme' =&gt; 'pager',
    '#weight' =&gt; 5,
);

return $build;


A dummy table is now displayed, but just in the first call to the page, not when the page is self called after submiting the form for first time. A custom table is then created to list all the results for a SELECT. This custom table is not displayed for some reason.
I think you should this in this way, so you should register you theme hook