diff --git a/fits_hdr2struct.pro b/fits_hdr2struct.pro
index db742027a484474c4add1bfdc8dfc2213d0c695f..e55516d39d52b5a183bc2ea1148d98061f21b414 100644
--- a/fits_hdr2struct.pro
+++ b/fits_hdr2struct.pro
@@ -7,7 +7,7 @@ function fits_hdr2struct, string_hdr
 		tag = tag.trim()
 		if tag eq '' then continue
 		if tag.startswith('end', /fold) or tag.contains('continue', /fold) then continue
-		if isa(struct) then if where(tag_names(struct) eq tag) ge 0 then continue
+		if isa(struct) then if (tag_names(struct)).hasvalue(tag) then continue
 		struct = create_struct(struct, tag.replace('-', ' '), fxpar(string_hdr, tag))
 	endfor
 
diff --git a/get_light_time.pro b/get_light_time.pro
index 4146dcf52a94fe5b330e6fd9163294606a116449..3e3c794b6089b484bac40fe4f64ed72866ac0765 100644
--- a/get_light_time.pro
+++ b/get_light_time.pro
@@ -1,16 +1,16 @@
-function get_light_time, utc, body, target, radvel = radvel
+function get_light_time, utc, target, observer, rad_velocity = rad_velocity
 
 	; convert the requested date into ephemeris time
 
 	cspice_str2et, utc, et
 
-	; coordinates of the body wrt the target in the j2000 system
+	; coordinates of the target wrt the target in the j2000 system
 
-	cspice_spkezr, body, et, 'J2000', 'NONE', target, state, ltime
+	cspice_spkezr, target, et, 'J2000', 'NONE', observer, state, light_time
 
 	; radial component of the velocity
 
-	radvel = 1000.d0 * total(state[0 : 2] * state[3 : 5])/sqrt(total(state[0 : 2]^2))
+	rad_velocity = 1000. * total(state[0 : 2] * state[3 : 5])/sqrt(total(state[0 : 2]^2))
 
-	return, ltime
+	return, light_time
 end
diff --git a/metis_flat_field.pro b/metis_flat_field.pro
index bac6264ee277210d28305b06bd484d0389ff2ae7..91aaf11df6c078b11188da22b71c28a354a175c9 100644
--- a/metis_flat_field.pro
+++ b/metis_flat_field.pro
@@ -24,7 +24,7 @@ function metis_flat_field, data, header, cal_pack, history = history
 	
 	mask = where(ff_image le 0.)
 	ff_image[mask] = 1.
-	data = data / ff_image
+	data = data/ff_image
 	data[mask] = 0.
 
 	if ~ isa(history) then history = !null
diff --git a/metis_l2_prep_uv.pro b/metis_l2_prep_uv.pro
index 25f4ed7ad145a0bf6115d5c9b87ff1c7df5bd487..debdbb6ee5d03d6266c647d0f38d4aef6e14f819 100644
--- a/metis_l2_prep_uv.pro
+++ b/metis_l2_prep_uv.pro
@@ -126,6 +126,7 @@ pro metis_l2_prep_uv
 	fxaddpar, primary_header, 'BUNIT', bunit
 	fxaddpar, primary_header, 'DATAMIN', min(data, /nan)
 	fxaddpar, primary_header, 'DATAMAX', max(data, /nan)
+	fxaddpar, primary_header, 'WAVEBAND', cal_pack.uv_channel.name
 	fxaddpar, primary_header, 'XPOSURE', header.xposure
 	fxaddpar, primary_header, 'NSUMEXP', header.nsumexp
 
@@ -136,10 +137,10 @@ pro metis_l2_prep_uv
 
 	; append solar ephemeris keywords
 
-	ephemerides = solo_get_ephemerides(header, constants = cal_pack.constants)
-	foreach element, ephemerides do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
+	ephemeris = solo_get_ephemeris(header, cal_pack)
+	foreach element, ephemeris do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
 
-	history = [history, 'Solar ephemerides and WCS:', '  SKD version = ' + kernel_version]
+	history = [history, 'Update WCS and solar ephemeris:', '  SKD version = ' + kernel_version]
 
 	; delete useless keywords
 
diff --git a/metis_l2_prep_vl_generic.pro b/metis_l2_prep_vl_generic.pro
index 334d3782a9980f517d34a2a605e85bdb5bb6158a..9ed677ef0e8974274da6fc2c7ea2b6075c64b5c0 100644
--- a/metis_l2_prep_vl_generic.pro
+++ b/metis_l2_prep_vl_generic.pro
@@ -120,6 +120,7 @@ pro metis_l2_prep_vl_generic
 	fxaddpar, primary_header, 'BUNIT', bunit
 	fxaddpar, primary_header, 'DATAMIN', min(data, /nan)
 	fxaddpar, primary_header, 'DATAMAX', max(data, /nan)
+	fxaddpar, primary_header, 'WAVEBAND', cal_pack.vl_channel.name
 	fxaddpar, primary_header, 'XPOSURE', header.xposure
 	fxaddpar, primary_header, 'NSUMEXP', header.nsumexp
 
@@ -130,10 +131,10 @@ pro metis_l2_prep_vl_generic
 
 	; append solar ephemeris keywords
 
-	ephemerides = solo_get_ephemerides(header, constants = cal_pack.constants)
-	foreach element, ephemerides do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
+	ephemeris = solo_get_ephemeris(header, cal_pack)
+	foreach element, ephemeris do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
 
-	history = [history, 'Solar ephemerides and WCS:', '  SKD version = ' + kernel_version]
+	history = [history, 'Update WCS and solar ephemeris:', '  SKD version = ' + kernel_version]
 
 	; delete useless keywords
 
diff --git a/metis_l2_prep_vl_polariz.pro b/metis_l2_prep_vl_polariz.pro
index db1bfcf6164fd746a910ef6d052c44c8c441b3ca..5c25a327f63c1ad52f078d96408e6f2c66c65fb2 100644
--- a/metis_l2_prep_vl_polariz.pro
+++ b/metis_l2_prep_vl_polariz.pro
@@ -224,6 +224,7 @@ pro metis_l2_prep_vl_polariz
 	fxaddpar, primary_header, 'OBT_BEG', header.obt_beg, 'Start acquisition time in on-board time', format = 'F0.5'
 	fxaddpar, primary_header, 'OBT_END', header.obt_end, 'End acquisition time in on-board time', format = 'F0.5'
 	fxaddpar, primary_header, 'TELAPSE', telapse, '[s] Elapsed time between beginning and end of observation'
+	fxaddpar, primary_header, 'WAVEBAND', cal_pack.vl_channel.name
 	fxaddpar, primary_header, 'XPOSURE', header.xposure
 	fxaddpar, primary_header, 'NSUMEXP', header.nsumexp
 	fxaddpar, primary_header, 'TSENSOR', header.tsensor
@@ -236,10 +237,11 @@ pro metis_l2_prep_vl_polariz
 
 	; append solar ephemeris keywords
 
-	ephemerides = solo_get_ephemerides(header, constants = cal_pack.constants)
-	foreach element, ephemerides do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
+	ephemeris = solo_get_ephemeris(header, cal_pack)
+	foreach element, ephemeris do fxaddpar, primary_header, element.name, element.value, element.comment, before = 'DATATYPE'
 
-	history = ['Solar ephemerides and WCS:', '  SKD version = ' + kernel_version]
+	history = ['Update WCS and solar ephemeris:', '  SKD version = ' + kernel_version]
+	
 	tb_history = [tb_history, history]
 	pb_history = [pb_history, history]
 
diff --git a/metis_rad_cal.pro b/metis_rad_cal.pro
index 30b67a2633b9725181dd5015396f19665963840a..7b236a48dbfd77a2b46d646481301c81ffa00329 100644
--- a/metis_rad_cal.pro
+++ b/metis_rad_cal.pro
@@ -17,7 +17,7 @@ function metis_rad_cal, data, header, cal_pack, polarimetric = polarimetric, his
 		rad_info = cal_pack.uv_channel.radiometry[0]
 		units = cal_pack.uv_channel.cal_units
 		pmp_factor = 1.D0
-		unit_factor = 1.
+		unit_factor = 1.D0
 	endif
 
 	rad_factor = rad_info.rad_response.value * pmp_factor * $
diff --git a/metis_rectify.pro b/metis_rectify.pro
index 327b06025ea3a622041f6e38d825cf8de88798c6..23db709fbcdc16a692a548ad62018a33f188009f 100644
--- a/metis_rectify.pro
+++ b/metis_rectify.pro
@@ -1,9 +1,9 @@
 function metis_rectify, image, filter
-	if filter.toupper() eq 'VL' then image = rotate(image, 1)
-	if filter.toupper() eq 'UV' then begin
+	if not keyword_set(filter) then filter = 'VL'
+	if filter.contains('VL', /fold) then image = rotate(image, 1) else begin
 		image = reverse(image, 1)
 		image = rotate(image, 1)
-	endif
+	endelse
 	
 	return, image
 end
diff --git a/solo_get_carrot.pro b/solo_get_carringrot.pro
similarity index 84%
rename from solo_get_carrot.pro
rename to solo_get_carringrot.pro
index 86127297f2094f7b17f632e04fbc8b3a597c064d..7ce924886fefff87dcd56f229b9f4ab01114d6f7 100644
--- a/solo_get_carrot.pro
+++ b/solo_get_carringrot.pro
@@ -1,10 +1,10 @@
-function solo_get_carrot, utc
+function solo_get_carringrot, utc
 
 	; initial estimate of the carrington rotation number
 
 	jul_day = date_conv(utc, 'julian')
 
-	carr = (jul_day - 2398167.D0)/27.2753D0 + 1
+	carr = (jul_day - 2398167.)/27.2753D0 + 1
 
 	; convert the requested date into ephemeris time
 
@@ -12,7 +12,7 @@ function solo_get_carrot, utc
 
 	; get the carrington longitude of earth
 
-	cspice_spkezr, 'EARTH', et, 'IAU_SUN', 'NONE', 'SUN', state, ltime
+	cspice_spkezr, 'EARTH', et, 'IAU_SUN', 'NONE', 'SUN', state, light_time
 
 	; convert rectangular coordinates into angular coordinates
 
diff --git a/solo_get_coords.pro b/solo_get_coords.pro
index b8d2ec462928acb678666cad075d9d58691e8301..dab61d4c22fa0d8c8df553daadad9b3051c0b7fd 100644
--- a/solo_get_coords.pro
+++ b/solo_get_coords.pro
@@ -1,4 +1,4 @@
-function solo_get_coords, utc, frame, obs, velocity = velocity, spherical = spherical, degrees = degrees
+function solo_get_coords, utc, frame, observer, spherical = spherical, degrees = degrees, velocity = velocity
 
 	; convert the requested date into ephemeris time
 
@@ -21,7 +21,7 @@ function solo_get_coords, utc, frame, obs, velocity = velocity, spherical = sphe
 
 	; coordinates of the s/c in the selected reference frame
 
-	cspice_spkezr, 'SOLO', et, frame, 'NONE', obs, state, ltime
+	cspice_spkezr, 'SOLO', et, frame, 'NONE', observer, state, light_time
 
 	coord = state[0 : 2]
 
diff --git a/solo_get_ephemerides.pro b/solo_get_ephemeris.pro
similarity index 88%
rename from solo_get_ephemerides.pro
rename to solo_get_ephemeris.pro
index ca3d91ce842f18a38002f01711d01552af326e8f..58a18f6e598ca65430e3e77ab1d6e2f17ab1a86b 100644
--- a/solo_get_ephemerides.pro
+++ b/solo_get_ephemeris.pro
@@ -1,9 +1,13 @@
-function solo_get_ephemerides, header, constants = constants
+function solo_get_ephemeris, header, cal_pack
+
+	; ephemerides are to be calculated for the average date of observation
 
 	utc = header.date_avg
 
-	rsun = constants.rsun.value
-	au = constants.au.value
+	; get useful physical constant
+
+	rsun = cal_pack.constants.rsun.value
+	au = cal_pack.constants.au.value
 
 	; compute and add the wcs keyword
 
@@ -47,7 +51,7 @@ function solo_get_ephemerides, header, constants = constants
 		value: solar_angles[2], $
 		comment: '[deg] S/C ecliptic North to solar North angle'}
 
-	carrot = solo_get_carrot(utc)
+	carrot = solo_get_carringrot(utc)
 
 	ephemerides.add, { $
 		name: 'CAR_ROT', $
@@ -91,7 +95,8 @@ function solo_get_ephemerides, header, constants = constants
 
 	; coordinates of the S/C in the hee frame
 
-	coord = solo_get_coords(utc, 'HEE', 'SUN') * 1000.
+	coord = solo_get_coords(utc, 'HEE', 'SUN')
+	coord = coord * 1000.
 
 	ephemerides.add, { $
 		name: 'HEEX_OBS', $
@@ -108,9 +113,9 @@ function solo_get_ephemerides, header, constants = constants
 
 	; coordinates of the S/C in the hci frame
 
-	coord = solo_get_coords(utc, 'HCI', 'SUN', velocity = veloc)
+	coord = solo_get_coords(utc, 'HCI', 'SUN', vel = vel)
 	coord = coord * 1000.
-	veloc = veloc * 1000.
+	vel = vel * 1000.
 
 	ephemerides.add, { $
 		name: 'HCIX_OBS', $
@@ -127,15 +132,15 @@ function solo_get_ephemerides, header, constants = constants
 
 	ephemerides.add, { $
 		name: 'HCIX_VOB', $
-		value: veloc[0], $
+		value: vel[0], $
 		comment: '[m/s] S/C Heliocentric Inertial X velocity'}
 	ephemerides.add, { $
 		name: 'HCIY_VOB', $
-		value: veloc[1], $
+		value: vel[1], $
 		comment: '[m/s] S/C Heliocentric Inertial Y velocity'}
 	ephemerides.add, { $
 		name: 'HCIZ_VOB', $
-		value: veloc[2], $
+		value: vel[2], $
 		comment: '[m/s] S/C Heliocentric Inertial Z velocity'}
 
 	; coordinates of the S/C in the hae frame
@@ -195,16 +200,16 @@ function solo_get_ephemerides, header, constants = constants
 	; light travel times and radial velocity of the S/C
 
 	earth_time = get_light_time(utc, 'EARTH', 'SUN')
-	sun_time = get_light_time(utc, 'SOLO', 'SUN', radvel = radvel)
-	tdel = earth_time - sun_time
+	sun_time = get_light_time(utc, 'SOLO', 'SUN', rad_vel = rad_vel)
+	t_del = earth_time - sun_time
 
 	ephemerides.add, { $
 		name: 'OBS_VR', $
-		value: radvel, $
+		value: rad_vel, $
 		comment: '[m/s] Radial velocity of S/C relative to Sun'}
 	ephemerides.add, { $
 		name: 'EAR_TDEL', $
-		value: tdel, $
+		value: t_del, $
 		comment: '[s] Time(Sun to Earth) - Time(Sun to S/C)'}
 	ephemerides.add, { $
 		name: 'SUN_TIME', $
@@ -216,12 +221,12 @@ function solo_get_ephemerides, header, constants = constants
 	utc = header.date_beg
 
 	jul_utc = date_conv(utc, 'julian')
-	date_earth = date_conv(jul_utc + tdel / 86400.d0, 'fits')
-	date_sun = date_conv(jul_utc - sun_time / 86400.d0, 'fits')
+	date_ear = date_conv(jul_utc + t_del/86400., 'fits')
+	date_sun = date_conv(jul_utc - sun_time/86400., 'fits')
 
 	ephemerides.add, { $
 		name: 'DATE_EAR', $
-		value: date_earth, $
+		value: date_ear, $
 		comment: '[UTC] Start time of observation, corrected to Earth'}
 	ephemerides.add, { $
 		name: 'DATE_SUN', $
diff --git a/solo_get_pointing.pro b/solo_get_pointing.pro
index e18ef4601650d755aa60662746556dbc37ea0da0..cb0d63e513155c18126ac3f005bd4e11a89ce08c 100644
--- a/solo_get_pointing.pro
+++ b/solo_get_pointing.pro
@@ -1,4 +1,4 @@
-function solo_get_pointing, utc, degrees = degrees, radians = radians, celestial = celestial
+function solo_get_pointing, utc, degrees = degrees, arcsec = arcsec
 
 	; convert the requested date into ephemeris time
 
@@ -6,7 +6,7 @@ function solo_get_pointing, utc, degrees = degrees, radians = radians, celestial
 
 	; convert the ephemeris time into s/c internal time
 
-	cspice_sce2c, -144L, et, clk_in
+	cspice_sce2c, -144, et, clk_in
 
 	; set the proper solar orbiter frame
 
@@ -14,7 +14,7 @@ function solo_get_pointing, utc, degrees = degrees, radians = radians, celestial
 
 	if keyword_set(celestial) then frame = 'J2000'
 
-	cspice_ckgp, -144000L, clk_in, 1, frame, cmat, clk_out, found
+	cspice_ckgp, -144000, clk_in, 1, frame, cmat, clk_out, found
 
 	if found then cspice_m2eul, cmat, 1, 2, 3, roll, pitch, yaw else return, replicate(0., 3)
 
@@ -30,11 +30,11 @@ function solo_get_pointing, utc, degrees = degrees, radians = radians, celestial
 
 	; correct any cases where the roll is greater than +/- 180 degrees
 
-	if abs(roll) gt !dpi then roll = roll - 2.d0 * !dpi * signum(roll)
+	if abs(roll) gt !dpi then roll = roll - 2. * !dpi * signum(roll)
 
 	; correct any cases where the pitch is greater than +/- 90 degrees
 
-	if abs(pitch) gt !dpi / 2.d0 then begin
+	if abs(pitch) gt !dpi / 2. then begin
 		yaw = yaw - !dpi * signum(yaw)
 		pitch = !dpi * signum(pitch) - pitch
 		roll = roll - !dpi * signum(roll)
@@ -42,8 +42,8 @@ function solo_get_pointing, utc, degrees = degrees, radians = radians, celestial
 
 	; apply correct units to the pointing vector
 
-	if keyword_set(radians) then rad_factor = 1. else rad_factor = 180.d0 / !dpi
-	if keyword_set(radians) or keyword_set(degrees) then arc_factor = 1. else arc_factor = 3600.
+	if keyword_set(degrees) or keyword_set(arcsec) then rad_factor = 180. / !dpi else rad_factor = 1.
+	if keyword_set(arcsec) then arc_factor = 3600. else arc_factor = 1.
 
 	yaw = yaw * rad_factor * arc_factor
 	pitch = pitch * rad_factor * arc_factor
diff --git a/solo_get_solar_angles.pro b/solo_get_solar_angles.pro
index 5ff8e0f292270d108b8320387cc73d895eb1734b..217e744cfdf1e176d2b2ccd5c36e7121ef2cf438 100644
--- a/solo_get_solar_angles.pro
+++ b/solo_get_solar_angles.pro
@@ -7,11 +7,12 @@ function solo_get_solar_angles, utc
 	cspice_pxform, 'IAU_SUN', 'J2000', et, rot
 	sun_north = rot[2, *]
 
-	cspice_spkezr, 'SUN', et, 'J2000', 'NONE', 'SOLO', state, ltime
+	cspice_spkezr, 'SUN', et, 'J2000', 'NONE', 'SOLO', state, light_time
 	coord = state[0 : 2]
+
 	rad = coord/sqrt(total(coord^2, 1))
 
-	cel_north = [0., 0., 1.D0]
+	cel_north = [0., 0., 1.]
 
 	sun_proj = sun_north - total(rad * sun_north) * rad
 	sun_proj = sun_proj/sqrt(total(sun_proj^2))
@@ -25,13 +26,14 @@ function solo_get_solar_angles, utc
 	x_proj = total(sun_proj * cel_proj)
 	y_proj = total(sun_proj * vec_proj)
 
-	p0 = atan(y_proj, x_proj) * 180.D0/!dpi
+	p0 = atan(y_proj, x_proj) * 180./!dpi
 
 	cspice_pxform, 'IAU_SUN', 'ECLIPJ2000', et, rot
 	sun_north = rot[2, *]
 
-	cspice_spkezr, 'SUN', et, 'ECLIPJ2000', 'NONE', 'SOLO', state, ltime
+	cspice_spkezr, 'SUN', et, 'ECLIPJ2000', 'NONE', 'SOLO', state, light_time
 	coord = state[0 : 2]
+
 	rad = coord/sqrt(total(coord^2, 1))
 
 	eclip_north = cel_north
@@ -48,14 +50,14 @@ function solo_get_solar_angles, utc
 	x_proj = total(sun_proj * ecl_proj)
 	y_proj = total(sun_proj * vec_proj)
 
-	ep = atan(y_proj, x_proj) * 180.D0/!dpi
+	ep = atan(y_proj, x_proj) * 180./!dpi
 
-	cspice_spkezr, 'SUN', et, 'IAU_SUN', 'NONE', 'SOLO', state, ltime
+	cspice_spkezr, 'SUN', et, 'IAU_SUN', 'NONE', 'SOLO', state, light_time
 	coord = state[0 : 2]
 
 	cspice_reclat, coord, dist, lon, lat
 
-	b0 = -lat * 180.D0/!dpi
+	b0 = -lat * 180./!dpi
 
 	return, [b0, p0, ep]
 end