fixed logic, now supports $