added support for arbitrary fill lengths