added more tests which resulted in more fixes
also added docs