refactored method to generate metadata file.
completed method to generate metadata file and made minor associated changes.
connected client with pwp_start()
removed extra code and fixed compile errors.