Rewrite to be more functional, concise; Update API to single exported function
Release minor 0.4.0