fixed a bug in calculation number for green bar, removed comments, added tests