messy, but functional app.