Implemented a new code structure which makes it easier to manage.