Add variable support and tidy up identifiers