Completed Refactoring

The refactoring of the AP and the schedular