Adding Bokeh plot return type

Return the code and div for a Bokeh plot if it is a PlotObject.
Restructure the code and comments to make them a bit more modular
for future changes.

Fixes #373.