Add to_amount
Cleanup code