Exhaustive test cover added; some bugs fixed