Updated with WrinklyNinja's changes.