adding tests and fixed issues that arose