Fix the bug which forced the key update time to be 1440, assign keys to times sequentially, and move the main method into a class.

Signed-off-by: Tyler O'Meara <Tyler@TylerOMeara.com>