total refactor

version 2