Fixed typos, added some helper functions