refactor code using `->>` macro