refactor to improve perfermance
refactor everything