Implement preprocess

Was scratching my head as to why the preprocess directive wasn't working, the I found the todo.  Implemented something that works well enough as far as I can tell...