First attempt at adding some type safety