fixed issues, added get for JSON, some refactoring