Some error handling and added 1 css:many html inlining logic