Code cleanup

Ruby reports number of warnings in debug mode thus I've fixed some of them to make our code a little bit clearer.