added testing code and sw1