Cleaned up code, added functionality to base class