Cleaned up the api a bit