Removed order by clause and unnecessary code