added single tests and did some optimizing