hardcoded cost removed; generic calculateG(); readme updated