Originally created by lol768. I added some features