Changed order of function arguments so callback is last, and added checks to see which argument is the callback.

Signed-off-by: Oskar Hane <oh@oskarhane.com>