Working prototype for config, patterns and handler

This was by far the most adventurous and difficult part! For
the rendering part, config part will have to be improved...