removed cookie functionality and made some code more efficient