Bug fixes to dynamic Creation

Added if last clicked condition to event handler, and clear body before
dynamic content generation