Made several fixes to rectify creation of controls and functioning of popup controls