code cleanup, added argument checking for web service