cleaned up javascript, added widget by widget templating