added code for use as a chrome application