Cleaning up hasattr code.