total refactor :)