Restructed to use classes, temporarily removed caching