Top level function implementations
Merged with RaviDevBranch, fixed conflicts