[REFACTOR] minor refactor & bug fixes