attempted similar function