getProperty function refactory