enhanced some functions

replaced iterative function of complexity O(n) with static function of
complexity O(1)