Adding my changes from Craytor's base