Build primitives using a dedicated builder class.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>