Variable tidying up bug fix