Add AppCtrl functionality and improve tests