Fixed bugs and added ranking method in flask.