modularized demo code