cleaned up resources constructor