Improve indentation checking function