             )
         </cfquery>
         <cfset subtitle = "Edit Beer">
-    <cfelseif StructKeyExists( request, "edit" ) AND request.beerId GT 0>
-        <cfquery name="getBeer">
-            SELECT  id
-                    ,breweryId
-                    ,name
-                    ,type
-                    ,abv
-                    ,ibu
-            FROM dbo.Beer
-            WHERE id = <cfqueryparam value="#request.beerId#" cfsqltype="cf_sql_integer">
-        </cfquery>
-        <cfset request.breweryId = getBeer.breweryId>
-        <cfset request.beerName = getBeer.name>
-        <cfset request.beerType = getBeer.type>
-        <cfset request.beerABV = getBeer.abv>
-        <cfset request.beerIBU = getBeer.ibu>
-        <cfset subtitle = "Edit Beer">
-    <cfelseif StructKeyExists( request, "delete" ) AND request.beerId GT 0>
-        <cfquery>
-            DELETE FROM dbo.Beer
-            WHERE id = <cfqueryparam value="#request.beerId#" cfsqltype="cf_sql_integer">
-        </cfquery>
-        <cflocation url="beer-list.cfm" addtoken="false">
     <cfelse>
         <cfset subtitle = "Add Beer">
     </cfif>

                            <div class="col-sm-10">
                                <select class="form-control" id="beerType" name="beerType" 
                                        required="required">
                                    <option value="0" 
                                        <cfif request.breweryId EQ 0>selected="selected"</cfif>>
                                        -Select a Style-</option>
                                    <cfloop query="getTypes">
                                        <option value="#getTypes.type#" 
                                            <cfif getTypes.type IS request.beerType>selected="selected"</cfif>>
                                            #getTypes.type#</option>
                                    </cfloop>
                                </select>

    <cfparam name="request.beerABV" type="numeric" default="0">
    <cfparam name="request.beerIBU" type="numeric" default="0">

    <cfif request.beerId GT 0>
        <cfquery name="getBeer">
            SELECT  id
                    ,breweryId
                    ,name
                    ,type
                    ,abv
                    ,ibu
            FROM dbo.Beer
            WHERE id = <cfqueryparam value="#request.beerId#" cfsqltype="cf_sql_integer">
        </cfquery>
    </cfif>
    <cfif request.beerId GT 0 AND getBeer.recordcount>
        <cfif StructKeyExists( request, "submit" )>
            <cfquery>
                UPDATE dbo.Beer
                SET breweryId = <cfqueryparam value="#request.breweryId#" cfsqltype="cf_sql_integer">
                    ,name = <cfqueryparam value="#request.beerName#" 
                          null="#!Len( Trim( request.beerName ) )#" cfsqltype="cf_sql_varchar">
                    ,type = <cfqueryparam value="#request.beerType#" 
                          null="#!Len( Trim( request.beerType ) )#" cfsqltype="cf_sql_varchar">
                    ,abv = <cfqueryparam value="#request.beerABV#" null="#!Len( Trim( request.beerABV ) )#" 
                          cfsqltype="cf_sql_decimal">
                    ,ibu = <cfqueryparam value="#request.beerIBU#" null="#!Len( Trim( request.beerIBU ) )#" 
                          cfsqltype="cf_sql_decimal">
                WHERE id = <cfqueryparam value="#request.beerId#" cfsqltype="cf_sql_integer">
            </cfquery>
            <cfset subtitle = "Edit Beer">
        <cfelseif StructKeyExists( request, "edit" )>
            <cfset request.breweryId = getBeer.breweryId>
            <cfset request.beerName = getBeer.name>
            <cfset request.beerType = getBeer.type>
            <cfset request.beerABV = getBeer.abv>
            <cfset request.beerIBU = getBeer.ibu>
            <cfset subtitle = "Edit Beer">
        <cfelseif StructKeyExists( request, "delete" )>
            <cfquery>
                DELETE FROM dbo.Beer
                WHERE id = <cfqueryparam value="#request.beerId#" cfsqltype="cf_sql_integer">
            </cfquery>
            <cflocation url="beer-list.cfm" addtoken="false">
        </cfif>
    <cfelseif StructKeyExists( request, "submit" ) AND request.beerId EQ 0>
        <cfquery>
            INSERT INTO dbo.Beer
