improved ranking and added dump to csv