improved check for valid callback method
decreased amount of duplicated code