Added rest of old code from my local repo