Class restructure, and more pythonic functions