Fixing errors
Better defining api
Moving to OTP