Added tests. Changed callbacks.
Fixing merge issues.