removed duplicate code, found automatic tick code