Completed histogram function