split main code into lib/cookiemonster.js