Removed rubbish code. Was I drunk when I wrote some of this?