works for power of two :)