Added API, fixes overflow, closes #7, closes #8