Fixed various issues, updated API