Refactoring -- Removed use of liftIO, fragmented buildFigure