Added hooks for controlling loaded status
Added random number generator