Added initial source code. Originally written by DonutAvenger and modified by yentup