added more type safety