put app building into it's own method