Removed assert() in favor of actual checks