moved button onclicklisteners for clarity