Second activity, improved main logic