Created login script with some error checking