refactored a lot. Removed json-simple dependencies