refactored how session mangement works to handle mysql going away