First Version on decimal function