Added support for better handling of cookies. Check $.cookie instead of this approach