Refactored keymaster to support AMD and use jQuery and underscore