issue 4 : some speed improvements