added the cookie funcitonality
merged with Dave's cool stuff