Completed and fixed errors.

Finished writing and testing stored procedure. Added return codes and fixed misc errors.