sorting functionality added