added in null checking