Refactor prefix & suffix code

also update docs