Changed error management to be useful for other developers. Now it has two callback-functions, success and error.