Changed api interface. Allowed internal callers to use api. Added user as parameter to all api calls.
Merged sharad's changes.