Changed || to && to allow for short-circuiting and added a check for require.main