make insert more flexible and refactor methods using exec