cleanup and add some primitives