Modified code structure of primitives to make it easier to read.