Tidy code. Switch to jsonlite. Remove implicit plyr dependency. Fix bugs (getSegments).