Made repetitive app menu buttons into a function