refactor and bunch of updates