fixed some todos
fixed more todos
code refactor
more refactoring