Some cleanup and added hasOwnProperty to check getSessions.