huge refactor, static calls excluded