Modified function used in post code