Changed around some things and exposed different functions.