Improved Wx code