Removed obsolete code and renamed functions