added returns for error checking