I think I wrote this code late in the night - too many typos :)