Cleaned up references and prevented some warnings