Simplified percentCalculate()
Added println debug statements
Other code refinements from Android port