magic square checking now in function