Merge "Added tests and improvements"