First attempt at implementation.