Better lib.sh impl