Warning cleanup

I runned IntelliJ Idea inspection on code and fixed some warnings.