tested the code and cleaned up