Some functions I needed