Remove test code and add test