Code cleanup (redundancies) and converted anonymous classes to lambdas