Refactor code to prevent error() calls at startup