fixed major memory issues, important API update