Initial implementation! Works for most things except for the predecessor function.