Method definition not expected here

Hello,
I am very new at all things programming; I am attempting to modify a SmartApp ([RELEASE] New Virtual Thermostat With Device) to allow a cooling setting.
I have made my modifications, but get the following error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script_app_metadata_35a524d0_e78c_483e_8d35_5193a303cc37: 78: Method definition not expected here. Please define the method at an appropriate place or perhaps try using a block/Closure instead. at line: 78 column: 1. File: script_app_metadata_35a524d0_e78c_483e_8d35_5193a303cc37 @ line 78, column 1.
def shouldHeatingBeOn(thermostat) {
^

This def is inside an if function (that I added). I tried moving the if function after the def but that just gave more errors.
I have uploaded the code to http://dev.ryancarmichael.com/VirtualThermostat/Thermostat (wasn’t sure if I should add the whole code to the body of this message); if anyone can assist in where I’m going wrong, I would greatly appreciate it!
Sincere regards,
Ryan Carmichael

You can’t do that. What other errors did you get?

Thank you for your reply.
I have moved the def outside the if, and added a line as the “else” at the end of the applicable section (there were two sections these modifications were made to). I have updated the CODE.
The errors I recieve are:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078: 78: Invalid variable name. Must start with a letter but was: “true”
. At [78:41] @ line 78, column 41.
uldHeatingBeOn(thermostat) != “true”) {
^

script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078: 50: Repetitive method name/signature for method ‘java.lang.Object shouldHeatingBeOn(java.lang.Object)’ in class ‘script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078’.
@ line 50, column 1.
def shouldHeatingBeOn(thermostat) {
^

script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078: 77: Repetitive method name/signature for method ‘java.lang.Object shouldHeatingBeOn(java.lang.Object)’ in class ‘script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078’.
@ line 77, column 1.
def shouldHeatingBeOn(thermostat) {
^

script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078: 107: Repetitive method name/signature for method ‘java.lang.Object getHeatingStatus(java.lang.Object)’ in class ‘script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078’.
@ line 107, column 1.
def getHeatingStatus(thermostat) {
^

script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078: 134: Repetitive method name/signature for method ‘java.lang.Object getHeatingStatus(java.lang.Object)’ in class ‘script_app_metadata_a0323c95_ebdc_4f41_924a_505c52db9078’.
@ line 134, column 1.
def getHeatingStatus(thermostat) {
^

5 errors

I ended up changing another section to get it working:

def handleChange() {
def thermostat = getThermostat()

//update device
thermostat.setHeatingStatus(getHeatingStatus(thermostat))
thermostat.setCoolingStatus(getCoolingStatus(thermostat))
thermostat.setVirtualTemperature(getAverageTemperature())

if(thermostat.currentValue('thermostatMode') == "off") {
//set outlet off
	outlets.off()

}

if(thermostat.currentValue('thermostatMode') == "heat") {
//set heater outlet
if(shouldHeatingBeOn(thermostat)) {
	outlets.on()
} else {
	outlets.off()
}

} else {

if(thermostat.currentValue('thermostatMode') == "cool") {
//set cooler outlet
if(shouldCoolingBeOn(thermostat)) {
	outlets.on()
} else {
	outlets.off()
}

}
}
}