removed unnecessary JSON.parse call and added unit tests