improving API, handling non-js files, JSON output option from CLI