Marked old functions as deprecated , some code cleanup.