Refactored code that sends cookie
Completed first part of remember-me feature.