Working region code along with java visualiser code for testing and visualization