improved code for testing at home