Fixed 'compilation' errors - currently gives NaN errors