refactored tick and fixed #16