Removed unused variable, added tick count check