modified some snippits