[refactor] Simplify code