added some psuedo code
code added, more broken than fixed