Implement tick function