Updating code to allow unit test to use try-catch block to catch warning
without stopping code execution inside try
Cleanup, removing redundant returns