fix score function + improve painter