Finished winks detection and cleaned the code a bit