Fixed null pointers, implementations, added methods to get and set flags