made improvements to check script