Adding structure and methods for the main logic