Serious rewrite (although the app is still incredibly basic)