Add branch functions

Clean up consts in #45 and make it build against head