code refactorin, addition/modification of sortedset API, PEP8 indentation