added some algo defines and utils