Function to replace manual chunk-offset setting. Code cleanup