[IMP] Move some methods to lib/utils.lua
[DEL] Lua script: Delete max and max_lines from method because
accessible globally