Moved test Code to Button Click Event