Updated actionperformed method