Library functions debugged (partial)