fixed function snippet a bit