refactors & bug fixes