code for locate