optimized code for better performance; added DemoButtonObject type