Refactored the data method for rendering and improved the checklogin process