Replaced some functions with macro