need to round down instead of up to avoid indexOutOfBounds