added currency support, trimmed code