updated functions with actual internals