moved code from maiin to app. makes things more centralized