Restructure and add user check on login