added Application class, cleaner code