added references and performed checks