Cleaned, Made Obsolete and moved some code

Please delete code marked Obsolete or remove the Obsolete Attribute