Better comments and error handling, trouble with js line numbers