Main Application edited so everything works