Tests are added. Some small fixes in main java files.
Conflict reloved