Add ugly function maxl using null, hd and tl with if statements.