chore(rewrite) : code optimization & code quality improvements