package re-implemented as source, fixed function calls