Correct error handling, added support for argument less functions