First attempt at some pseudo code