Changed dice to non-global variable
Refactored to add prototype function using object literals