improved code:
 - moved duplicated function out of classes
clean up code:
 - removed commented code
 - add docstrings
 - modified comments in the code to make it more clear
 - PEP 8