Rewrite everything with more OO approach