Code refactored + score added