Cleaned up validation

Added better null-checking on properties passed through the API.