added testing and fixed a few things