added code for snippets, added a directive took out cookie and put it in a service