Basic working code. (with alerts)