Adding ap control and debug