Added flakePosition option to pure JS version