Fixed deprecation warnings & scalastyle errors