start rewriting quote functions from scratch