refactor: moved code arround
less code complexity