added test, and cleaned