changed local variables to be final