Added button sending code and other minor changes