test code and end loops