refactor half of public JS; todo: refactor of content view