Changes balance function to use aggregate.

Also removes unused files/lines as commented in the pull request.