Changed some methods to global