added some type safety