Restored original file and tweaked back

Some functions were not included, so i restored the original file and
then re-added my additions.